Greater than or equal to (>=) Comparison Operator
The “greater than or equal to” (>=) operator is a comparison operator used in programming languages to determine whether the value or expression on the left of the operand is greater than or equal to the value or expression on the right.
Example of Greater than or equal to (>=) Comparison Operator:
Here are the example of Greater than or equal to (>=) Operator in different language:
#include <iostream>
using namespace std;
int main()
{
int x = 5;
int y = 5;
if (x >= y) {
cout << "x is greater than or equal to y"
<< endl;
}
else {
cout << "x is not greater than or equal to y"
<< endl;
}
return 0;
}
#include <stdio.h>
int main()
{
int x = 5;
int y = 5;
if (x >= y) {
printf("x is greater than or equal to y\n");
}
else {
printf("x is not greater than or equal to y\n");
}
return 0;
}
public class Main {
public static void main(String[] args)
{
int x = 5;
int y = 5;
if (x >= y) {
System.out.println(
"x is greater than or equal to y");
}
else {
System.out.println(
"x is not greater than or equal to y");
}
}
}
let x = 5;
let y = 5;
if (x >= y) {
console.log("x is greater than or equal to y");
} else {
console.log("x is not greater than or equal to y");
}
x = 5
y = 5
if x >= y:
print("x is greater than or equal to y")
else:
print("x is not greater than or equal to y")
Output
x is greater than or equal to y
Comparison Operators in Programming
Comparison Operators in programming are used to compare values and determine their relationship, such as equality, inequality, greater than, less than, etc. They evaluate expressions and return a Boolean value (true or false) based on the comparison result, crucial for decision-making in conditional statements and loops.
Table of Content
- What is a Comparison Operator?
- Common Comparison Operators
- Equal to (==) Comparison Operator
- Not equal to (!=) Comparison Operator
- Greater than (>) Comparison Operator
- Greater than or equal to (>=) Comparison Operator
- Less than (<) Comparison Operator
- Less than or equal to (<=) Comparison Operator